#include <iostream>
#include <stdint.h>
using namespace std;
struct ncFileHeader
{
    unsigned int endian : 16;		// Endian Type：little endian（1），big endian（0）
	unsigned int padding1 : 16;		// Padding for 64bit align
	unsigned int magic;				// Magic number
	unsigned int blockLength;		// Block length
	unsigned int blockCount;		// Block count
	unsigned int version;			// version
	unsigned int padding2;			// version
	int64_t fid;					// The fid of the file
	int64_t reserved1;				// Reserved 8 Byte 1
	int64_t reserved2;				// Reserved 8 Byte 2
};

//#define PACKED 
#define PACKED __attribute__((packed))

struct niniu {
int a1;
int a2;
int a5;
int64_t a3;
int64_t a4;
} PACKED ;

int main ()
{
    cout << sizeof(niniu) << "-----" << sizeof(ncOFSFileHeader) << endl;
    unsigned char* ptr = new unsigned char[1024 + sizeof(niniu)];
    niniu* pn = (niniu*)(ptr );
    pn->a1=10;
    for(int i = 0; i < 1024; i+=1) {
        cout << "offset: " << i << endl;
        //int* ipn = (int*)(ptr + i);
        //*ipn = 11;
        niniu* pn = (niniu*)(ptr + i);
        pn->a1=10;
    }
    return 0;
}
